<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>遍历</title>
</head>
<body>
    <input type="button" id="btn" value="集合">
   <ul>
     <li>a</li>
     <li>b</li>
   </ul>
</body>
    <script src="../../js/jquery-3.3.1.min.js"></script>
    <script>
      //$.each()方法
      $("#btn").click(function (){
        let list = $("li");
        $.each(list,function(index,ele){
          alert(index+","+ele.innerHTML);
        });
      });

      //for of 语句   增强for，没索引
      $("#btn").click(function(){
        let list = $("li");
        for (ele of list){
          alert(ele.innerHTML);
        }
      });
    </script>
</html>